import {AfterContentChecked, AfterContentInit, AfterViewChecked, Component, OnDestroy, OnInit} from '@angular/core';

@Component({
  selector: 'app-content-child',
  templateUrl: './content-child.component.html',
  styleUrls: ['./content-child.component.css']
})
export class ContentChildComponent implements OnInit, AfterContentInit, AfterContentChecked, OnDestroy  {

  message: string;

  constructor() {
  }

  ngOnInit() {
  }

  /*方法调用在view之前，改变message的值，浏览器不会报错*/
  ngAfterContentInit(): void {
    console.log('子组件投影视图初始化完毕');
    this.message = 'Test';
  }

  ngAfterContentChecked(): void {
    console.log('子组件投影变更检检测完毕');
  }

  ngOnDestroy(): void {
    console.log('子组件被销毁');
  }
}
